from manim import *

class PrimeFactorization(Scene):
    def construct(self):
        number = 168
        prime_factors = self.prime_factorization(number)
        
        title = Text("Prime Factorization", font_size=40).to_edge(UP)
        self.play(Write(title))

        number_text = Text(f"Number: {number}", font_size=30).to_edge(LEFT)
        self.play(Write(number_text))

        prime_factors_text = Text("Prime Factors:", font_size=30).next_to(number_text, DOWN)
        self.play(Write(prime_factors_text))

        factors_text = Text(f"{prime_factors}", font_size=30).next_to(prime_factors_text, DOWN)
        self.play(Write(factors_text))
        
        self.wait(2)

    def prime_factorization(self, n):
        factors = []
        divisor = 2
        while n > 1:
            while n % divisor == 0:
                factors.append(divisor)
                n //= divisor
            divisor += 1
        return factors

